using System;
using System.Collections.Generic;
using UnityEngine;

namespace PropertySystem
{
    [Serializable]
    public abstract class DynamicProperty
    {
        protected ValueModifier _maxValue;
        protected ValueModifier _minValue;
        protected float _value;
        public float Value { get => _value; protected set => _value = Math.Max(_minValue.Value, Math.Min(value, _maxValue.Value)); }

        protected float _difference;

        public DynamicProperty()
        {
            _maxValue = new ValueModifier();
            _minValue = new ValueModifier();
        }

        public void GetDifference(float difference) { _difference = difference; }
        public bool IsToBeBelowThreshold(float threshold) { return Value + _difference < threshold; }
        public bool IsToBeBeyondThreshold(float threshold) { return Value + _difference > threshold; }
        public bool IsToBeEqualToTarget(float target) { return Value + _difference == target; }
    }
}
